﻿using System;
using System.ComponentModel;
using System.Runtime.InteropServices;

namespace Teigha.Core
{
	public class OdGsDCRect : IDisposable
	{
		[EditorBrowsable(EditorBrowsableState.Never)]
		public OdGsDCRect(IntPtr cPtr, bool cMemoryOwn)
		{
			this.swigCMemOwn = cMemoryOwn;
			this.swigCPtr = new HandleRef(this, cPtr);
		}

		[EditorBrowsable(EditorBrowsableState.Never)]
		public static HandleRef getCPtr(OdGsDCRect obj)
		{
			if (obj != null)
			{
				return obj.swigCPtr;
			}
			return new HandleRef(null, IntPtr.Zero);
		}

		~OdGsDCRect()
		{
			this.Dispose();
		}

		public virtual void Dispose()
		{
			if (this.swigCPtr.Handle != IntPtr.Zero)
			{
				if (this.swigCMemOwn)
				{
					lock (this.locker)
					{
						if (this.swigCPtr.Handle != IntPtr.Zero && this.swigCMemOwn)
						{
							this.swigCMemOwn = false;
							GlobalsPINVOKE.delete_OdGsDCRect(this.swigCPtr);
						}
					}
					this.swigCMemOwn = false;
				}
				this.swigCPtr = new HandleRef(null, IntPtr.Zero);
			}
			GC.SuppressFinalize(this);
		}

		public OdGsDCRect() : this(GlobalsPINVOKE.new_OdGsDCRect__SWIG_0(), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGsDCRect(OdGsDCPoint minPoint, OdGsDCPoint maxPoint) : this(GlobalsPINVOKE.new_OdGsDCRect__SWIG_1(OdGsDCPoint.getCPtr(minPoint), OdGsDCPoint.getCPtr(maxPoint)), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGsDCRect(int xMin, int xMax, int yMin, int yMax) : this(GlobalsPINVOKE.new_OdGsDCRect__SWIG_2(xMin, xMax, yMin, yMax), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGsDCRect(OdGsDCRect.NullFlag arg0) : this(GlobalsPINVOKE.new_OdGsDCRect__SWIG_3((int)arg0), true)
		{
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGsDCRect Assign(OdGsDCRect dcRect)
		{
			OdGsDCRect result = new OdGsDCRect(GlobalsPINVOKE.OdGsDCRect_Assign(this.swigCPtr, OdGsDCRect.getCPtr(dcRect)), false);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool IsEqual(OdGsDCRect dcRect)
		{
			bool result = GlobalsPINVOKE.OdGsDCRect_IsEqual(this.swigCPtr, OdGsDCRect.getCPtr(dcRect));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool IsNotEqual(OdGsDCRect dcRect)
		{
			bool result = GlobalsPINVOKE.OdGsDCRect_IsNotEqual(this.swigCPtr, OdGsDCRect.getCPtr(dcRect));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void set_null()
		{
			GlobalsPINVOKE.OdGsDCRect_set_null(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public bool is_null()
		{
			bool result = GlobalsPINVOKE.OdGsDCRect_is_null(this.swigCPtr);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public bool within(OdGsDCRect dcRect)
		{
			bool result = GlobalsPINVOKE.OdGsDCRect_within(this.swigCPtr, OdGsDCRect.getCPtr(dcRect));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
			return result;
		}

		public void offset(int x, int y)
		{
			GlobalsPINVOKE.OdGsDCRect_offset(this.swigCPtr, x, y);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void intersectWith(OdGsDCRect dcRect, bool bValidate)
		{
			GlobalsPINVOKE.OdGsDCRect_intersectWith__SWIG_0(this.swigCPtr, OdGsDCRect.getCPtr(dcRect), bValidate);
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public void intersectWith(OdGsDCRect dcRect)
		{
			GlobalsPINVOKE.OdGsDCRect_intersectWith__SWIG_1(this.swigCPtr, OdGsDCRect.getCPtr(dcRect));
			if (GlobalsPINVOKE.SWIGPendingException.Pending)
			{
				throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
			}
		}

		public OdGsDCPoint m_min
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGsDCRect_m_min_get(this.swigCPtr);
				OdGsDCPoint result = (intPtr == IntPtr.Zero) ? null : new OdGsDCPoint(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGsDCRect_m_min_set(this.swigCPtr, OdGsDCPoint.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		public OdGsDCPoint m_max
		{
			get
			{
				IntPtr intPtr = GlobalsPINVOKE.OdGsDCRect_m_max_get(this.swigCPtr);
				OdGsDCPoint result = (intPtr == IntPtr.Zero) ? null : new OdGsDCPoint(intPtr, false);
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
				return result;
			}
			set
			{
				GlobalsPINVOKE.OdGsDCRect_m_max_set(this.swigCPtr, OdGsDCPoint.getCPtr(value));
				if (GlobalsPINVOKE.SWIGPendingException.Pending)
				{
					throw GlobalsPINVOKE.SWIGPendingException.Retrieve();
				}
			}
		}

		private object locker = new object();

		private HandleRef swigCPtr;

		protected bool swigCMemOwn;

		public enum NullFlag
		{
			Null
		}
	}
}
